package de.uni.muenster.idw2.location.bluetooth.service.fingerprinting.images;

/**
 * Represents a bitmap as an three-dimensional array.
 * 
 * @author Eva Peters
 *
 */
public class ArrayBitmap 
{
	/**
	 * The two-dimensional array.
	 */
	private boolean[][] array;

	/**
	 * Constructor.
	 * 
	 * @param width The width.
	 * @param height The height.
	 */
	public ArrayBitmap(int width, int height)
	{
		this.array = new boolean[width][height];
	}
	
	/**
	 * Checks if the pixel value is marked at the specified position.
	 * 
	 * @param x X position (to the right).
	 * @param y Y position (down).
	 * @return True if the pixel is marked. Otherwise false.
	 */
	public boolean isPixelMarked(int x, int y)
	{
		return array[x][y];
	}
	
	/**
	 * Marks the pixel at the specified position.
	 * 
	 * @param x X position (to the right).
	 * @param y Y position (down).
	 */
	public void markPixel(int x, int y)
	{
		array[x][y] = true;
	}
	
	public void unmarkAllPixels(){
		for (int i=0; i < array.length; i++){
			for (int j=0; j < array[0].length; j++){
				array[i][j]= false;
			}
		}
	}
}
